# 修改后的model.py.j2模板
from sqlalchemy import Boolean, String
from sqlalchemy.orm import Mapped, mapped_column
from src.core.base.orm.orm import AbstractORMModel


class Codegenerator(AbstractORMModel):
    __tablename__ = "code_generator"
    __table_args__ = {"comment": "代码生成"}

    field_name: Mapped[str] = mapped_column(
        String(50), nullable=False, comment="字段名称", sort_order=1
    )
    field_type: Mapped[str | None] = mapped_column(
        String(50), nullable=True, comment="类型", sort_order=2
    )
    field_description: Mapped[str | None] = mapped_column(
        String(50), nullable=True, comment="字段描述", sort_order=3
    )
    field_default_value: Mapped[str | None] = mapped_column(
        String(50), nullable=True, comment="默认值", sort_order=4
    )
    field_is_key: Mapped[bool | None] = mapped_column(
        Boolean(50), nullable=True, comment="是否主键", sort_order=5
    )
    field_is_nullable: Mapped[bool | None] = mapped_column(
        Boolean(50), nullable=True, comment="是否允许为空", sort_order=6
    )
    field_is_unique: Mapped[bool | None] = mapped_column(
        Boolean(50), nullable=True, comment="是否唯一", sort_order=7
    )
    field_is_auto_increment: Mapped[bool | None] = mapped_column(
        Boolean(50), nullable=True, comment="是否自增", sort_order=8
    )
